package com.situ.day2;

import org.junit.Test;

public class WhileDemo {

	@Test
	public void test1() {
		int count = 1;
		while (count <= 5) {
			System.out.println("Hello World!");
			count = count + 1;
		}
	}
	
	// 1+2+3+4+...+99+100=5050
	@Test
	public void test2() {
		int i = 1;
		int sum = 0;
		while (i <= 100) {
			System.out.println(i);
			sum = sum + i;
			i = i + 1;
		}
		//计算完成之后打印累加和
		System.out.println(sum);
	}
	
	// 1*9=9  2*9=18  3*9=27 ... 8*9=72  9*9=81
	@Test
	public void test3() {
		int i = 1;
		while (i <= 9) {
			System.out.print(i + "*9=" + (i * 9) + "\t");
			i = i + 1;
		}
	}
	
	
	
	
	
	
}
